package com.example.api.converter;

import com.example.api.dto.UserDTO;
import com.example.api.entity.User;


public class UserConverter {
    public static UserDTO convertUserToUserDTO(User user) {

        UserDTO userDTO = new UserDTO();

        userDTO.setUserId(user.getUserId());
        userDTO.setUsername(user.getUsername());
        userDTO.setEmail(user.getEmail());
        userDTO.setPhone(user.getPhone());
        userDTO.setStatus(user.getStatus());
        userDTO.setLastLogin(user.getLastLogin());
        userDTO.setCreatedAt(user.getCreatedAt());
        userDTO.setRemark(user.getRemark());

        return userDTO;
    }

    public static User convertUserDTOToUser(UserDTO userDTO) {

        User user = new User();

        user.setUserId(userDTO.getUserId());
        user.setUsername(userDTO.getUsername());
        user.setEmail(userDTO.getEmail());
        user.setPhone(userDTO.getPhone());
        user.setStatus(userDTO.getStatus());
        user.setLastLogin(userDTO.getLastLogin());
        user.setCreatedAt(userDTO.getCreatedAt());
        user.setRemark(userDTO.getRemark());

        return user;
    }
}
